package it.patterns.structural.flyweight;

/**
 * Use sharing to support large numbers of fine-grained objects efficiently,
 * without prohibitive costs.
 * 
 * A Flyweight is a shared object that can be used in multiple contexts
 * simultaneously. It can not make assumptions on the context it operates. The
 * key concept is the distinction between intrinsic and extrinsic state:
 * intrinsic state is stored in the flyweight; it consists of information that
 * is independent of the flyweight context. Extrinsic state depends on and
 * varies with the flyweght's context. Client objects are responsible for
 * passing extrinsic state to the flyweight when it needs it.
 * 
 * 
 * Applications:
 * <ul>
 * <li>an application uses a large number of objects</li>
 * <li>storage costs are high because of the sheer quantity of objects</li>
 * <li>most object state can be made extrinsic</li>
 * <li>the application doesn't depend on object identity</li>
 * <li></li>
 * <li></li>
 * </ul>
 * 
 * 
 * Flyweight may introduce run-time costs associated with transferring, finding,
 * computing extrinsic state.
 * 
 * <img src="Flyweight.jpg" alt="Pattern Structure"/>
 * 
 * @author Luca D'Onofrio
 * 
 * @category Structural Pattern
 * @see "Design Patterns - Element of Reusable Object Oriented Software (Gamma,Helm, Johnson, Vlissides)"
 * 
 * @version 1.0
 * 
 */
public interface Flyweight {
	public String operation(String extrinsicState);

	public String getIntrinsic();
	public boolean isEqualsTo(Flyweight flyweight);
}
